/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package de.blitzcoder.collide.config.textarea;

import javax.swing.table.AbstractTableModel;

/**
 *
 * @author blitzcoder
 */
class TableModel extends AbstractTableModel {

    private String[] colNames = new String[]{"Name", "BlitzMax-Name", "Vorschau"};
    private Object[][] data;

    public TableModel(Object[][] data) {
        this.data = data;
    }

    public int getColumnCount() {
        return colNames.length;
    }

    public int getRowCount() {
        return data.length;
    }

    public String getColumnName(int col) {
        return colNames[col];
    }

    public Object getValueAt(int row, int col) {
        return data[row][col];
    }

    // To display checkboxes and the preview panel
    public Class getColumnClass(int c) {
        return getValueAt(0, c).getClass();
    }

    public boolean isCellEditable(int row, int col) {
        // Just row 2 is editable, the preview panels
        return col == 2;
    }
}
